package com.it.myd;

import com.it.myd.filter.SuperFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;


@SpringBootApplication
@MapperScan("com.it.myd.dao")
public class MydApplication {

    public static void main(String[] args) {
        SpringApplication.run(MydApplication.class, args);
        FileWatcherExample.main(args);
    }

    @Bean
    public FilterRegistrationBean<SuperFilter> loggingFilter(){
        FilterRegistrationBean<SuperFilter> registrationBean = new FilterRegistrationBean<>();

        registrationBean.setFilter(new SuperFilter());
        registrationBean.addUrlPatterns("/*");
        registrationBean.setOrder(1); // 设置过滤器的顺序

        return registrationBean;
    }

}
